<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Easy
  </div>
  <div>
   <h1 class="question_title">
    219. Contains Duplicate II
   </h1>
   <p>
    Given an array of integers and an integer
    <i>
     k
    </i>
    , find out whether there are two distinct indices
    <i>
     i
    </i>
    and
    <i>
     j
    </i>
    in the array such that
    <b>
     nums[i] = nums[j]
    </b>
    and the
    <b>
     absolute
    </b>
    difference between
    <i>
     i
    </i>
    and
    <i>
     j
    </i>
    is at most
    <i>
     k
    </i>
    .
   </p>
   <div>
    <p>
     <strong>
      Example 1:
     </strong>
    </p>
    <pre>
<strong>Input: </strong>nums = <span id="example-input-1-1">[1,2,3,1]</span>, k = <span id="example-input-1-2">3</span>
<strong>Output: </strong><span id="example-output-1">true</span>
</pre>
    <div>
     <p>
      <strong>
       Example 2:
      </strong>
     </p>
     <pre>
<strong>Input: </strong>nums = <span id="example-input-2-1">[1,0,1,1]</span>, k = <span id="example-input-2-2">1</span>
<strong>Output: </strong><span id="example-output-2">true</span>
</pre>
     <div>
      <p>
       <strong>
        Example 3:
       </strong>
      </p>
      <pre>
<strong>Input: </strong>nums = <span id="example-input-3-1">[1,2,3,1,2,3]</span>, k = <span id="example-input-3-2">2</span>
<strong>Output: </strong><span id="example-output-3">false</span>
</pre>
     </div>
    </div>
   </div>
  </div>
  <div>
   <h1 class="question_title">
    219. 存在重复元素 II
   </h1>
   <p>
    给定一个整数数组和一个整数&nbsp;
    <em>
     k
    </em>
    ，判断数组中是否存在两个不同的索引
    <em>
     &nbsp;i
    </em>
    &nbsp;和
    <em>
     &nbsp;j
    </em>
    ，使得&nbsp;
    <strong>
     nums [i] = nums [j]
    </strong>
    ，并且
    <em>
     i
    </em>
    和
    <em>
     j
    </em>
    &nbsp;的差的绝对值最大为
    <em>
     k
    </em>
    。
   </p>
   <p>
    <strong>
     示例&nbsp;1:
    </strong>
   </p>
   <pre><strong>输入:</strong> nums = [1,2,3,1], k<em> </em>= 3
<strong>输出:</strong> true</pre>
   <p>
    <strong>
     示例 2:
    </strong>
   </p>
   <pre><strong>输入: </strong>nums = [1,0,1,1], k<em> </em>=<em> </em>1
<strong>输出:</strong> true</pre>
   <p>
    <strong>
     示例 3:
    </strong>
   </p>
   <pre><strong>输入: </strong>nums = [1,2,3,1,2,3], k<em> </em>=<em> </em>2
<strong>输出:</strong> false</pre>
  </div>
 </body>
</html>